#!/bin/bash

#ubuntu:20.04
#web: weharmonyos.com
#author: turing
#本脚本用于下载源码包和设置用户的环境变量,在 sudo ./weharmonyos.sh 执行成功后执行
#在脚本所在目录,执行以下命令即可,注意不要用 sudo 
#turing@ubuntu:~$./path.sh

# 下载源码包,目前鸿蒙轻量级内核最新源码包为code-v1.1.1-LTS.tar.gz,后续有更新替换自行替换 
mkdir -p /home/openharmony
wget -P /home/openharmony https://repo.huaweicloud.com/harmonyos/os/1.1.1/code-v1.1.1-LTS.tar.gz
tar xvf /home/openharmony/code-v1.1.1-LTS.tar.gz -C /home/openharmony

sed -i '$aexport PATH=/home/tools/llvm/bin:$PATH' ~/.bashrc
sed -i '$aexport PATH=/home/tools/hc-gen:$PATH' ~/.bashrc
sed -i '$aexport PATH=/home/tools/gcc_riscv32/bin:$PATH' ~/.bashrc
sed -i '$aexport PATH=/home/tools/ninja:$PATH' ~/.bashrc
sed -i '$aexport PATH=/home/tools/node-v12.20.0-linux-x64/bin:$PATH' ~/.bashrc
sed -i '$aexport PATH=/home/tools:$PATH' ~/.bashrc
sed -i '$aexport PATH=~/.local/bin:$PATH' ~/.bashrc
export PATH=/home/tools/llvm/bin:$PATH
export PATH=/home/tools/hc-gen:$PATH
export PATH=/home/tools/gcc_riscv32/bin:$PATH
export PATH=/home/tools/ninja:$PATH
export PATH=/home/tools/node-v12.20.0-linux-x64/bin:$PATH
export PATH=/home/tools:$PATH
export PATH=~/.local/bin:$PATH
source ~/.bashrc

#输入 hb 或 gn 验证是否成功
#turing@ubuntu:~$ hb
#usage: hb [-h] [-v] {build,set,env,clean,deps} ...
#OHOS Build System version 0.4.2

